package com.googlecode.gwtbb.client.only.widget.display.forum;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.googlecode.gwtbb.client.only.GwtUtils;
import com.googlecode.gwtbb.client.only.GwtbbCmess;
import com.googlecode.gwtbb.client.only.widget.basic.Spacer;
import com.googlecode.gwtbb.client.only.widget.display.user.UserLink;
import com.googlecode.gwtbb.client.shared.entity.forum.Post;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since May 6, 2008
 */
public class PostSummary extends Composite {
	public PostSummary(Post post) {
		HorizontalPanel mainPanel = new HorizontalPanel();
		initWidget(mainPanel);
		mainPanel.setStylePrimaryName("gwtbb-small");
		mainPanel.add(new Label(GwtUtils.formatSec(post.getCreateDate())));
		Post.Info postInfo = post.getInfo();
		if (postInfo != null) {
			mainPanel.add(new Spacer());
			mainPanel.add(new Label(GwtbbCmess.instance().byLabel()));
			mainPanel.add(new Spacer());
			mainPanel.add(new UserLink(postInfo.getUser()));
		}
	}
}
